package com.ruoyi.system.controller;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.service.IProfitHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("Giftrecord")
public class GiftrecordController {

    @Autowired
    private IProfitHistoryService iProfitHistoryService;

    /**
     * 获取受送礼记录
     * author：戴泽杨
     */

    @RequestMapping(path="/userhistory",method = RequestMethod.POST)
    @ResponseBody
    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public AjaxResult getgiftrecord(HttpServletRequest request){
        /**
            tag 为1代表送礼记录，为2代表收礼记录
        **/
        String tag = request.getParameter("tag");
        String userid = request.getParameter("userid");
        return AjaxResult.success(iProfitHistoryService.selectRecordedbroadcastByuserId(userid,tag));
    }
}
